home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkGraph.h.z / VkGraph.h
C/C++ Source or Header  |  1996-09-20  |  7KB  |  231 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17. #ifndef VKGRAPH_H
  18. #define VKGRAPH_H
  19.  
  20. #include <Vk/VkComponent.h>
  21.  
  22. class VkNode;
  23. class VkWindow;
  24. class VkPopupMenu;
  25. class VkMenuItem;
  26. class VkOptionMenu;
  27.  
  28. class VkNodeDictionary;
  29.  
  30. typedef Boolean (*VkGraphFilterProc) (VkNode *);
  31. typedef void (*VkGraphNodeProc) (VkNode *);
  32.  
  33. class VkGraph : public VkComponent {
  34.  
  35.     friend class VkNode;
  36.  
  37.  public:
  38.  
  39.     VkGraph(char * name, Widget);
  40.     virtual ~VkGraph();
  41.  
  42.     void saveToFile();
  43.  
  44.     Widget twinsButton() { return _twinsButton; }
  45.     Widget relayButton() { return _relayGraphButton; }
  46.     Widget reorientButton() { return _toggleLayoutButton;}
  47.     Widget workArea() { return _workArea;}
  48.  
  49.     void makeNodeVisible(VkNode *);
  50.  
  51.     virtual void buildGraph();
  52.     virtual void tearDownGraph();
  53.  
  54.     void showOverview();
  55.     void hideOverview();
  56.     VkWindow *overviewWindow() { return _overviewWindow; }
  57.  
  58.     void clearAll();
  59.     virtual void displayAll();
  60.  
  61.     void sortAll();
  62.  
  63.     virtual void add(VkNode *node, int index1, VkNode *node2, int index2, char *attribute = NULL);
  64.     virtual int  add(VkNode * , int index = -1);
  65.     virtual void add(VkNode * , VkNode*, char *attribute = NULL);
  66.  
  67.     virtual void remove(VkNode *node, Boolean deleteNode = FALSE);
  68.  
  69.     virtual void undisplay(VkNode * node);
  70.     virtual void undisplayAllArcs();
  71.  
  72.     void setSize(int);
  73.     void resetSize(int);
  74.  
  75.     virtual void display(VkNode *child);
  76.  
  77.     virtual VkNode *display(char *name);
  78.  
  79.     virtual void hideParentsAndChildren(VkNode *node);
  80.     virtual void displayParentsAndChildren(VkNode *node);
  81.     virtual VkNode *displayParentsAndChildren(char *name);
  82.  
  83.     virtual void hideNode(VkNode *node);
  84.  
  85.     virtual void hideParents(VkNode *node);
  86.     virtual void displayWithParents(VkNode *node);
  87.     virtual VkNode *displayWithParents(char *name);
  88.  
  89.     virtual void displayWithAllParents(VkNode *node);
  90.     virtual VkNode *displayWithAllParents(char *name);
  91.  
  92.     virtual void displayWithChildren(VkNode *node);    
  93.     virtual VkNode *displayWithChildren(char *name);
  94.  
  95.     virtual void displayWithAllChildren(VkNode *node);    
  96.     virtual VkNode *displayWithAllChildren(char *name);
  97.  
  98.     virtual void displayButterfly(VkNode *node);    
  99.     virtual VkNode *displayButterfly(char *name);
  100.  
  101.     virtual void displayIf(VkGraphFilterProc);
  102.  
  103.     virtual void hideAllChildren(VkNode *);
  104.     virtual void hideWithAllChildren(VkNode *);
  105.  
  106.     virtual void expandNode(VkNode *);
  107.     virtual void expandSubgraph(VkNode *);
  108.  
  109.     virtual void forAllNodesDo(VkGraphNodeProc);
  110.  
  111.     virtual void setLayoutStyle(char);
  112.  
  113.     VkNode *find(char *);
  114.     VkNode *find(int );
  115.  
  116.     void doLayout();
  117.     void doSubtreeLayout(VkNode *);
  118.     void doSparseLayout();
  119.  
  120.     int numNodes() { return _numNodes; }
  121.  
  122.     Widget graphWidget() { return _graphWidget; }
  123.  
  124.     static const char *const arcCreatedCallback;
  125.     static const char *const arcDestroyedCallback;
  126.  
  127.     static VkComponent*  CreateVkGraph(const char *name, Widget parent);
  128.     
  129.  protected:
  130.  
  131.     Boolean       _callArcDestroyedHook;
  132.  
  133.     VkNode  **_nodeList;
  134.     int       _numNodes;
  135.     int       _maxNodes;
  136.  
  137.     VkNode *_butterflyNode;
  138.  
  139.     VkPopupMenu  *_desktopMenu;
  140.  
  141.     VkMenuItem   *_collapse;
  142.     VkMenuItem   *_collapseSelected;
  143.  
  144.     VkPopupMenu  *_popupMenu;
  145.     VkMenuItem   *_expand;
  146.     VkMenuItem   *_bigExpand;
  147.     VkMenuItem   *_expandSelected;
  148.  
  149.     VkMenuItem   *_hide;
  150.     VkMenuItem   *_hideSelected;
  151.     VkMenuItem   *_hideParents;
  152.     VkMenuItem   *_expandParents;
  153.  
  154.     VkMenuItem   *_popupTitleObj;
  155.     VkNode       *_selectedNode;
  156.  
  157.     virtual void buildCmdPanel(Widget);
  158.     virtual void buildZoomMenu(Widget);
  159.     virtual void addMenuItems(VkPopupMenu *);
  160.     virtual void addDesktopMenuItems(VkPopupMenu *);
  161.     virtual void popupMenu(VkNode *, XEvent *);
  162.     virtual void setZoomOption(int);
  163.  
  164.     virtual void arcCreatedHook(VkNode *, Widget, VkNode *);
  165.     virtual void arcDestroyedHook(Widget);
  166.     virtual void twinsVisibleHook(Boolean);
  167.  
  168.   private:
  169.  
  170.     static String _resources[];
  171.  
  172.     VkNodeDictionary *_nodeDict;   
  173.  
  174.     void updateVisualState(VkNode *);
  175.     void updateVisualState();
  176.     void updateSubtreeVisualState(VkNode *node);
  177.  
  178.     void nodeDestroyed(VkCallbackObject *, void *, void *);
  179.  
  180.     Pixmap _simple, _simpleArm, _complex, _complexArm;
  181.  
  182.     Widget _fileBrowser;
  183.     Widget _graphWidget, _twinsButton, _relayGraphButton, _toggleLayoutButton;
  184.     Widget _cmds, _zoomIn, _zoomOut, _overviewButton;
  185.     Widget _workArea;
  186.     VkWindow *_overviewWindow;
  187.  
  188.     static void saveToFileCallback(Widget, XtPointer, XtPointer);
  189.     static void popupMenuCallback(Widget, XtPointer, XtPointer);
  190.     static void showOverviewCallback(Widget, XtPointer, XtPointer);
  191.     static void hideNodeCallback(Widget, XtPointer, XtPointer);
  192.     static void collapseSubgraphCallback(Widget, XtPointer, XtPointer);
  193.  
  194.     static void expandNodeCallback(Widget, XtPointer, XtPointer);
  195.     static void expandSubgraphCallback(Widget, XtPointer, XtPointer);
  196.  
  197.     static void expandSelectedCallback(Widget, XtPointer, XtPointer);
  198.     static void hideSelectedCallback(Widget, XtPointer, XtPointer);
  199.     static void collapseSelectedCallback(Widget, XtPointer, XtPointer);
  200.  
  201.     static void hideParentsCallback(Widget, XtPointer, XtPointer);
  202.     static void expandParentsCallback(Widget, XtPointer, XtPointer);
  203.  
  204.     static void relayCallback(Widget, XtPointer, XtPointer);
  205.     static void twinsCallback(Widget, XtPointer, XtPointer);
  206.     static void toggleLayoutCallback(Widget, XtPointer, XtPointer);
  207.     static void optionSetCallback(Widget, XtPointer, XtPointer);
  208.     static void zoomInCallback(Widget, XtPointer, XtPointer);
  209.     static void zoomOutCallback(Widget, XtPointer, XtPointer);
  210.  
  211.     void overviewDeletedCallback(VkCallbackObject *, void *, void *);
  212.  
  213.     VkOptionMenu *_zoomOptionMenu;
  214.     VkMenuItem   *_items[10];
  215.     int           _childSpacing[10];
  216.     int           _siblingSpacing[10];
  217.     String        _labels[10];
  218.     XmFontList    _fonts[10];
  219.     int           _sizeOfZoomList;
  220.     int           _zoomIndex;
  221.     Boolean       _twinsVisible;
  222.  
  223.     void displayWithAllChildrenAux(VkNode *node);    
  224.     void displayWithAllParentsAux(VkNode *node);    
  225.  
  226.  
  227. };
  228.  
  229. #endif
  230.  
  231.